package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.asm.Handle;
import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.InvokeDynamicInstructionBytecodeEvent;

public class InvokeDynamicInstructionBytecodeEventImpl extends BytecodeEventImpl implements
    InvokeDynamicInstructionBytecodeEvent
{
    private String methodName;
    private String methodDescriptor;
    private Handle bootstrapMethodHandle;
    private Object[] bootstrapMethodArguments;

    public InvokeDynamicInstructionBytecodeEventImpl(final String aMethodName, final String aMethodDescriptor,
        final Handle aBootstrapMethodHandle, final Object[] aBootstrapMethodArguments)
    {
        methodName = aMethodName;
        methodDescriptor = aMethodDescriptor;
        bootstrapMethodHandle = aBootstrapMethodHandle;
        bootstrapMethodArguments = aBootstrapMethodArguments;
    }

    @Override
    public int getType() {
        return INVOKE_DYNAMIC_INSTRUCTION;
    }

    @Override
    public void setMethodName(final String aMethodName) {
        methodName = aMethodName;
    }

    @Override
    public String getMethodName() {
        return methodName;
    }

    @Override
    public void setMethodDescriptor(final String aMethodDescriptor) {
        methodDescriptor = aMethodDescriptor;
    }

    @Override
    public String getMethodDescriptor() {
        return methodDescriptor;
    }

    @Override
    public void setBootstrapMethodHandle(final Handle aBootstrapMethodHandle) {
        bootstrapMethodHandle = aBootstrapMethodHandle;
    }

    @Override
    public Handle getBootstrapMethodHandle() {
        return bootstrapMethodHandle;
    }

    @Override
    public void setBootstrapMethodArguments(final Object[] aBootstrapMethodArguments) {
        bootstrapMethodArguments = aBootstrapMethodArguments;
    }

    @Override
    public Object[] getBootstrapMethodArguments() {
        return bootstrapMethodArguments;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitInvokeDynamicInstruction(this);
        return aBytecodeVisitor;
    }
}
